//
//  CornerBtn.m
//  TanTanDemo
//
//  Created by wei1 on 2016/12/3.
//  Copyright © 2016年 qge. All rights reserved.
//

#import "CornerBtn.h"
#define btnShrinkScale .95
@implementation CornerBtn

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    self.layer.cornerRadius = frame.size.height/2;
    [self addTargets];
    return self;
}

//+(instancetype)buttonWithType:(UIButtonType)buttonType{
//    CornerBtn *btn = [super buttonWithType:buttonType];
//    [btn addTargets];
//    return btn;
//}

-(void)setHighlighted:(BOOL)highlighted{
    
}

-(void)addTargets{
    [self addTarget:self action:@selector(shrink) forControlEvents:UIControlEventTouchDown];
    [self addTarget:self action:@selector(recover) forControlEvents:UIControlEventTouchUpInside];
}

-(void)shrink{
    self.transform = CGAffineTransformMakeScale(btnShrinkScale, btnShrinkScale);
}

-(void)recover{
    self.transform = CGAffineTransformIdentity;
}

@end
